package com.googlecode.cardamomo.ermodel;

import java.util.Vector;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

public class DataType {

	public static final String CARDAMOMO_NAMESPACE =
			"http://cardamomo.googlecode.com/cardamomo-model";
	
	private String name;
	
	private boolean multiple = Boolean.FALSE;
	
	private boolean nillable = Boolean.FALSE;
	
	private Vector<DataType> elements = null;
	
	private BasicType baseType = null;
	
	private String comment;
	
	private boolean numeric = Boolean.FALSE;
	
	private boolean signed = Boolean.FALSE;
	
	private int length = 1;

	public DataType(String string, BasicType i, boolean b, boolean c, int len, boolean num) {
		setName(string);
		setBaseType(i);
		setMultiple(b);
		setNillable(c);
		setLength(len);
		setNumeric(num);
	}

	@XmlAttribute
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@XmlElement(defaultValue="false")
	public boolean isMultiple() {
		return multiple;
	}

	public void setMultiple(boolean multiple) {
		this.multiple = multiple;
	}

	public boolean isNillable() {
		return nillable;
	}

	public void setNillable(boolean nillable) {
		this.nillable = nillable;
	}

	@XmlAttribute(name="basetype")
	public BasicType getBaseType() {
		return baseType;
	}

	public void setBaseType(BasicType baseType) {
		this.baseType = baseType;
	}

	@XmlElementWrapper(name="elements")
	@XmlElement(name="element")
	public Vector<DataType> getElements() {
		return elements;
	}

	public void setElements(Vector<DataType> elements) {
		this.elements = elements;
	}

	@XmlAttribute(name="length")
	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	@XmlElement(name="comment")
	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public boolean isNumeric() {
		return numeric;
	}

	public void setNumeric(boolean numeric) {
		this.numeric = numeric;
	}

	public boolean isSigned() {
		return signed;
	}

	public void setSigned(boolean signed) {
		this.signed = signed;
	}


}
